#include <bits/stdc++.h>
using namespace std;

int n;
int ans = 0;
int main() {
    cin >> n;
    int l, h;
    int t = 0;
    for (int i = 1; i <= n; i++) {
        cin >> h >> l;
        if (h >= 90 && h <= 140 && l >= 60 && l <= 90) {
            t++;
            if (t > ans)
                ans = t;
        } else
            t = 0;
    }

    cout << ans;
    return 0;
}